import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-myc01',
  templateUrl: './myc01.component.html',
  styleUrls: ['./myc01.component.css'],
})
export class Myc01Component implements OnInit {
  todo = '';
  todoList = ['任务一'];
  doAdd() {
    this.todoList.push(this.todo);
    this.todo = '';
  }
  eventHandler(event: any) {
    console.log('触发事件处理方法了');
    if (event.keyCode == 13) {
      if (this.todo == '') {
        return;
      }
      this.doAdd();
    }
  }
  constructor() {}

  ngOnInit(): void {}
}
